#include <iostream>
using namespace std;
struct Boxer
{
        string name;
        int weight;
        unsigned short life;
        Boxer(string pname, int pweight)
        {
            name = pname;
            weight = pweight;
            life = 100;
        }
        void introduce()
        {
            cout<<"I am "<< name <<"and I am "<<weight <<"kilogram!"<< endl;
        }
        /*
        void operator+ (int n)
        {
            cout<<"member"<<endl;
            weight = weight + n;
        }
         */
};
Boxer operator+(Boxer   b, int & n)
{
    cout<<"friend with reference"<<endl;
    b.weight = b.weight + n;
    return b;
}
/*
void operator+(Boxer  b, int n)
{
    cout<<"friend"<<endl;
    b.weight = b.weight + n;
}
*/
istream & operator>>(istream & in, Boxer & b)
{
    in>>b.name>>b.weight>>b.sex;
    return in;
}
ostream & operator<<(ostream & out, Boxer & b)
{
    out<<b.name<<b.weight<<b.sex;
    return out;
}
bool operator< (Boxer a,Boxer b)
{
    return a.weight<b.weight;
}
int main()
{
      Boxer tyson("Tyson",80,true);
      tyson.introduce();
      int temp = 2;
      tyson = tyson + temp;
      tyson.introduce();
      //cin>>tyson;
      //tyson.introduce();
       //Boxer a[3] ={{"a",11,true},{"a",9,true},{"a",19,true}};
       /*
       a[0]= Boxer("a",19,true);
       a[1]= Boxer("b",12,true);
       a[2]= Boxer("c",18,true);
       */
       vector<Boxer> a ={{"dvdvda",11,true},{"avdvd",9,true},{"ddvdva",19,true}};
       cout<<sizeof(a)/sizeof(Boxer);

       //sort(begin(a),end(a),[](Boxer a,Boxer b){return a.weight<b.weight;});
       struct compare
       {
           bool operator()(Boxer a,Boxer b)
           {
                return a.name>b.name;
           }
       } comp;
       sort(begin(a),end(a),comp);
       for(auto e: a)
           cout<<e;

}